package com.fub.util.database.databaseHelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class UpdatesDatabaseManager extends SQLiteOpenHelper {
	private static final String DATENBANK_NAME = "updates.db";
	private static final int Version = 2;
	public static final String TABLE_NAME_UPDATES = "updates";
	public static final String COL_ID_BUILDING ="building_id";
	public static final String ID_COL = "_id";
	public static final String COL_KEY = "col";
	public static final String COL_VALUE = "value";
	private static final String CREATE_TABLE_UPDATES = String
			.format("create table %s (%s text not null, %s text not null, %s text not null, %s text not null);",
					TABLE_NAME_UPDATES, COL_ID_BUILDING, ID_COL, COL_KEY, COL_VALUE);

	public UpdatesDatabaseManager(Context context) {
		super(context, DATENBANK_NAME, null, Version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE_UPDATES);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_UPDATES);
		onCreate(db);
	}
}
